Repository navigation
feat(browser): Read the release from the sentry-release meta tag - #26514
sentry-junior[bot] wants to merge 3 commits into
Conversation
size-limit report 📦Compared: 2b2ba0e (PR test merge using develop at 05f7607) Against: eb8ab33 (develop) · base run #66626
|
Optional E2E testsSome optional checks were not successful. They do not block the merge. 1 not successful, 62 successful. See the run.
Successful checks
|
isaacs
left a comment
There was a problem hiding this comment.
The design is right. One reader in the browser SDK, one renderer in @sentry/core/server, and the tag name in one place is the simplification this stack needed. It also gives the release to apps that call Sentry.init from @sentry/browser or @sentry/react directly. The cost of a few bytes in every browser bundle is acceptable, and Size Check passes.
The crash when creating a client blocks this PR: it fails CI now and could break Sentry.init in real environments with a partial document. The __SENTRY_RELEASE__ order should be fixed at the same time, and the SvelteKit Cloudflare failures need a re-run or an explanation. Once those are done, this is ready to land.
My answers to the open decisions in the description:
- Meta tag before
SENTRY_RELEASE: yes forwindow.SENTRY_RELEASE. No for__SENTRY_RELEASE__, as the second concern above explains. - Bundle size: this is acceptable, and Size Check passes.
- SolidStart's self-closing
<meta .../>: this is fine. HTML parsers treat both forms the same.
ea4e999 to
3ba2c8a
Compare
The browser SDK now picks up the release from `<meta name="sentry-release">` when `init` gets none. SvelteKit, SolidStart, React Router and TanStack Start drop their own client readers, and their servers render the tag with one shared helper from `@sentry/core`. Co-Authored-By: Isaac Schlueter <isaac.schlueter@sentry.io>
…release` meta tag The define belongs to the one bundle that set it, while the meta tag belongs to the page, so an embedded script on another app's page keeps its own release.
3ba2c8a to
04c6dd6
Compare
What
@sentry/browsernow reads the release from<meta name="sentry-release">whenSentry.init()gets norelease. SvelteKit, SolidStart, React Router and TanStack Start drop their own client readers. Their servers now render the tag with one shared helper,_INTERNAL_getReleaseMetaTagfrom@sentry/core/server, which replaces four copies ofescapeAttribute. The order is: an explicitrelease, then a__SENTRY_RELEASE__define, then the meta tag, thenwindow.SENTRY_RELEASE. An empty tag is ignored.Why
Each SDK in this stack had its own copy of the meta tag reader, the tag name, and the attribute escaping. With one reader in the browser SDK, every framework that renders the tag gets the same behavior.
Decided in review:
window.SENTRY_RELEASE, after__SENTRY_RELEASE__: any bundle on the page can setwindow.SENTRY_RELEASE, and the page is more current than a cached chunk. A__SENTRY_RELEASE__define belongs to the one bundle that set it, so an embedded script on another app's page keeps its own release.@sentry/browsergets a few bytes bigger for every user. This is acceptable.<meta .../>, the same as the other SDKs.Stacked on #26513.
Ref: #26485
via Isaac Schlueter.
--
View Session [Sentry]